package com.sand.controller;

import com.sand.dto.Select.UserSelect;
import com.sand.dto.worker.AddWorker;
import com.sand.dto.worker.WorkerDto;
import com.sand.result.ResponseResult;
import com.sand.service.WorkerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/worker")
public class WorkerController {

    @Autowired
    private WorkerService workerService;


    /**
     * 新增工人
     */
    @PostMapping("/add")
    private ResponseResult<String> add(@RequestBody AddWorker addOrWorker){
        String i =  workerService.add(addOrWorker);
        return new ResponseResult<String>().okResult(i);
    }

    /**
     * 修改工人类型
     */


    /**
     * 查询工人
     */
    @PostMapping("/select")
    private ResponseResult<WorkerDto> select(@RequestBody UserSelect userSelect){
        WorkerDto workerDto = workerService.select(userSelect);
        return new ResponseResult<WorkerDto>().okResult(workerDto);
    }




}
